//********************************************************************************************************************//
//ORGANIZATION:
//AUTHOR: bpeng(bogers.peng@gmail.com)
//SUMMARY:
//********************************************************************************************************************//
#include "../ExceedMemoryException.h"

using namespace Native::System;

void CExceedMemoryException::Check(
    C_SCENE& scene,
    size_t checked,
    size_t allowable,
    WSTRING& arguments,
    WSTRING& detail) throw()
{
    if (checked > allowable) {
        throw CExceedMemoryException(scene, checked, allowable, arguments, detail);
    }
}

CExceedMemoryException::CExceedMemoryException()
{
}

CExceedMemoryException::CExceedMemoryException(C_EXCEED_MEMORY_EXCEPTION& that) :
    CException(that)
{
}

CExceedMemoryException::CExceedMemoryException(C_EXCEED_MEMORY_EXCEPTION&& that) :
    CException(that)
{
}

CExceedMemoryException::CExceedMemoryException(
    C_SCENE& scene,
    size_t input_size,
    size_t allowable_size,
    WSTRING& arguments,
    WSTRING& detail)
{
    wchar_t message[MAX_MESSAGE_LENGTH] = {0};

    wsprintf(message, L"Input size:[%u] exceeds allowable size:[%u]", input_size, allowable_size);

    Append(CCase(scene, message, arguments, detail));
}